﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading.Tasks;

public class CharacterController
{
    FSMSystem m_FSMSystem = new FSMSystem();

    private void MakeFSM()
    {
        MoveState moveState = new MoveState();
        FrozenState frozenState = new FrozenState();
        IdleState idleState = new IdleState();
        AttackState attackState = new AttackState();

        m_FSMSystem.AddState(moveState);
        m_FSMSystem.AddState(frozenState);
        m_FSMSystem.AddState(idleState);
        m_FSMSystem.AddState(attackState);

    }

    public void ExecFSM()
    {
        MakeFSM();
        TestFSM();
    }

    async void TestFSM()
    {
        await Task.Yield();
        m_FSMSystem.ChangeState(EFSMState.eAttackState);
        await Task.Delay(1000);
        m_FSMSystem.ChangeState(EFSMState.eIdleState);
        await Task.Delay(2000);
        m_FSMSystem.ChangeState(EFSMState.eFrozenState);
    }
}
